package dahua_design.model1_01;
/**
 * @ClassName: Operation
 * @Description: 操作类   业务与操作对象分开
 * @Version: v1.0.0
 * @Author: tamir
 * @Date: 2022/05/26
 * Modification History:
 * Date             Author      Version     Description
 * -------------------------------------------------------------
 * 2022/05/26      tamir        v1.0.0      创建
 */
public class Operation {
	public  static Integer getResult(Integer num1,Integer num2,String op){
		Integer res = null;
		switch (op) {
			case "+":
				res = num1 + num2;
				break;
			case "-":
				res = num1 - num2;
				break;
			case "*":
				res = num1 * num2;
				break;
			case "/":
				if (num2 != 0) {
					res = num1 / num2;
				} else {
					System.out.println("除数不能为0");
				}
				break;
			default:
				break;
		}
		return  res;
	}
}
